package mock.appcode.dao.daointerface;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ResourceBundle;

public class BaseDAOImpl implements BaseDAO {
	static ResourceBundle rb = ResourceBundle.getBundle("config");
	// JDBC driver name and database url
	static String JDBC_DRIVER = rb.getString("jdbc.driver");
	static String DATABASE_URL = rb.getString("jdbc.url");
	static String userName = rb.getString("jdbc.user");
	static String pass = rb.getString("jdbc.password");

	public BaseDAOImpl() {

	}

	public Connection getConnection() {
		try {
			Class.forName(JDBC_DRIVER);
			try {
				Connection con = DriverManager.getConnection(DATABASE_URL,
						userName, pass);
				return con;
			} catch (SQLException sql) {
				sql.printStackTrace();
			}
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return null;
	}

}
